import { Checkbox, List, NavBar, Space, Stepper, SwipeAction } from 'antd-mobile';
import { MoreOutline } from 'antd-mobile-icons';
import React, { Component } from 'react';
import './Orders.scss'
import service from '../../api';

class Orders extends Component<any, any> {
    constructor(props: any) {
        super(props);
        this.state = {
            confirmOrder: [],
            list: [],
        }
    }

    async componentDidMount() {
        var res = await service.order.confirmOrder({ userid: localStorage.getItem('userid'), time: localStorage.getItem('time') })
        console.log(res);
        this.setState({
            list: this.state.list.concat(res.data.data),
            confirmOrder: this.state.confirmOrder.concat(res.data.data),
        })


    }
    updatenum() {

    }
    render() {
        return (
            <div className='orders'>
                <div className="top">
                    <NavBar onBack={() => { this.props.history.go(-1) }} right={<MoreOutline style={{ fontSize: 35 }} />}>订单管理</NavBar>
                </div>


                <div className="cart">
                    {
                        this.state.confirmOrder.map((item: any, index: any) => {

                            return (
                                <div className="box" key={index}>
                                    <div className="left">
                                        <img src={item.img1} alt="" />
                                    </div>
                                    <div className="right">
                                        <div className="name">{item.proname}</div>
                                        <div className="price">¥ {item.originprice}</div>
                                    </div>
                                </div>
                            )
                        })
                    }
                </div>

            </div>
        );
    }
}

export default Orders;